package com.qianbao.controller;


import com.fasterxml.jackson.databind.ObjectMapper;
import com.qianbao.components.svversion.ApiVersion;
import com.qianbao.domain.user.ModifyPasswordEntity;
import com.qianbao.utils.RedisConstants;
import com.qianbao.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class HelloController {


    @Autowired
    private ObjectMapper mapper;

    @Autowired
    private RedisUtil redisUtil;



    @ApiVersion(4)
    @ResponseBody
    @RequestMapping("/hello")
    public String helloVersion4(){
        return "helloVersion4";
    }



    @RequestMapping("/test-redis")
    @ResponseBody
    public ModifyPasswordEntity testRedis(){
        System.out.println("=================测试redis===================");

        ModifyPasswordEntity entity = new ModifyPasswordEntity();
        entity.setNewPassword("123456");
        entity.setOldPassword("654321");
        entity.setPhone("13121380325");

        redisUtil.set("user",entity,RedisConstants.datebase5);

        ModifyPasswordEntity user = (ModifyPasswordEntity) redisUtil.get("user", RedisConstants.datebase5);

        return user;

    }



}
